
package com.hanhai.zrb.api.biz.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hanhai.zrb.api.biz.service.SequenceService;
import com.hanhai.zrb.api.biz.service.UserSequenceService;
import com.hanhai.zrb.model.common.Sequence.SequenceName;

@Service("userSequenceService")
public class UserSequenceServiceImpl implements UserSequenceService {

	@Resource
	private SequenceService sequenceService;

	@Override
	public Long getNextUserId() {
		String str1 = String.format("%09d", getUserSequenceNext());
		String userId = "1" + str1;
		return Long.parseLong(userId);
	}
	
	@Override
	public Long getNextGovmentUserId(){
		String str1 = String.format("%09d", getUserSequenceNext());
		String userId = "2" + str1;
		return Long.parseLong(userId);
	}

	
	@Override
	public Long getUserSequenceNext() {
		return sequenceService.getNextBySequenceName(SequenceName.USER_SEQUENCE
				.name());
	}
	
	
}
